/* 基础样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #fff;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 添加渐变和动画效果 */
:root {
  --primary-gradient: linear-gradient(135deg, #2563eb, #1d4ed8);
  --hover-gradient: linear-gradient(135deg, #1d4ed8, #1e40af);
  --success-gradient: linear-gradient(135deg, #22c55e, #16a34a);
  --error-gradient: linear-gradient(135deg, #ef4444, #dc2626);
}

/* 添加平滑过渡效果 */
* {
  transition: all 0.2s ease;
}

/* 标题栏样式 */
.title-bar {
  height: 40px;
  background: linear-gradient(to right, #2563eb, #1d4ed8);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
  -webkit-app-region: drag;
  user-select: none;
  border-bottom: 1px solid #e5e5e5;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.title-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo {
  width: 24px;
  height: 24px;
}

.app-name {
  color: white;
  font-size: 14px;
  font-weight: 500;
}

.version {
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
}

.title-right {
  display: flex;
  align-items: center;
  -webkit-app-region: no-drag;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: white;
  font-size: 16px;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.icon-btn img {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1);
}

.window-controls button {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-family: "Segoe MDL2 Assets";
  font-size: 12px;
  cursor: pointer;
  color: white;
}

.window-controls button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.window-controls .close:hover {
  background: #e81123;
  color: #fff;
}

/* 输入区域样式 */
.input-area {
  padding: 12px;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
}

.url-input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.url-input {
  flex: 1;
  height: 36px;
  padding: 0 16px;
  border: 2px solid #e2e8f0;
  border-radius: 18px;
  outline: none;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.url-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.new-task-btn {
  padding: 0 24px;
  height: 36px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: 18px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.new-task-btn:hover {
  background: var(--hover-gradient);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
}

/* 选项区域 */
.options-area {
  display: flex;
  align-items: center;
  gap: 16px;
}
.options-area label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #475569;
  font-size: 13px;
  cursor: pointer;
}
.auto-download-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #666;
  font-size: 13px;
}

/* 开关样式 */
.switch {
  width: 36px;
  height: 20px;
  background: #e2e8f0;
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
}

.switch.active {
  background: #2563eb;
}

.switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.switch.active::after {
  transform: translateX(16px);
}

/* 下载路径区域 */
.download-path {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #666;
  font-size: 14px;
}

.path-text {
  color: #1e40af;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 4px;
  background: #f5f5f5;
  border-radius: 4px;
  cursor: pointer;
}

.change-path-btn {
  padding: 2px 8px;
  background: #f5f5f5;
  border: none;
  border-radius: 4px;
  color: #666;
  cursor: pointer;
  font-size: 12px;
}

.path-text:hover,
.change-path-btn:hover {
  background: #e5e5e5;
}

/* 列表操作区样式 */
.list-operations {
  padding: 6px;
  background: #f5f5f5;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 状态筛选下拉框 */
.status-filter {
  width: 120px;
  height: 24px;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0 8px;
  font-size: 14px;
  color: #333;
  background: #fff;
  cursor: pointer;
}

/* 搜索框 */
.search-box {
    position: relative;
    flex: 1;
    max-width: 300px;
}

.search-input {
    width: 100%;
    height: 24px;
    padding: 0 28px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}

.search-icon {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.clear-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    cursor: pointer;
    display: none;
}

.clear-icon.show {
    display: block;
}

.clear-icon:hover {
    color: #475569;
}

/* 批量操作按钮 */
.batch-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.batch-btn {
  padding: 6px 16px;
  height: 24px;
  border-radius: 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

/* 美化按钮样式 */
.batch-btn#selectAllBtn,
.batch-btn#selectInverseBtn {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.batch-btn#deleteBtn {
  background: #fee2e2;
  color: #dc2626;
  border: none;
}

.batch-btn#moreBtn {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.batch-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 资源列表样式 */
.resource-list {
  flex: 1;
  overflow-y: auto;
  background: #fff;
}

.resource-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  margin: 8px;
}

.resource-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 解析中状态 */
.parsing-icon {
  width: 80px;
  height: 32px;
  background: var(--primary-gradient);
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  color: white;
  font-size: 13px;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
  white-space: nowrap;
}

.parsing-icon::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid white;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  flex-shrink: 0;
}

/* 解析失败状态 */
.resource-item.failed {
  background: linear-gradient(to right, #fef2f2, #ffffff);
  border-left: 4px solid #ef4444;
}

.failed-message {
  color: #dc2626;
  font-size: 13px;
  line-height: 1.5;
  margin-top: 4px;
  padding: 4px 8px;
  background: #fef2f2;
  border-radius: 4px;
  display: inline-block;
}

/* 下载中状态 */
.progress-area {
  margin-top: 12px;
}

/* 进度条容器 */
.progress-container {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.progress {
  height: 100%;
  background: var(--primary-gradient);
  transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.progress-text {
  font-size: 12px;
  color: #64748b;
  min-width: 45px;
  white-space: nowrap; /* 确保文本不会换行 */
  overflow: hidden; /* 隐藏溢出的内容 */
}

/* 统一信息区域样式 */
.progress-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
}

.progress-info .file-path {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-info .size-info {
  flex-shrink: 0;
}

/* 下载成功状态 */
.resource-item.success {
  background: linear-gradient(to right, #f0fdf4, #ffffff);
  border-left: 4px solid #22c55e;
}

/* 下载失败状态 */
.resource-item.download-failed {
  background: #fef2f2;
}

/* 操作按钮组 */
.action-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-btn {
  padding: 1px 16px;
  border-radius: 16px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.action-btn.download {
  background: var(--primary-gradient);
  color: white;
  border: none;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.action-btn.download:hover {
  background: var(--hover-gradient);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
}

.action-btn.cancel {
  background: #fee2e2;
  color: #dc2626;
  border: none;
}

.action-btn.more {
  background: #f5f5f5;
  color: #666;
  border: 1px solid #ddd;
}
.action-btn.more:hover {
  background: #e5e5e5;
  transform: translateY(-1px);
}

/* 更多操作下拉菜单 */
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  min-width: 140px;
  z-index: 100;
  display: none;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  padding: 8px 12px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-item:hover {
  background: #f5f5f5;
}

/* 二维码弹窗 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 8px;
  padding: 20px;
  min-width: 300px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 16px;
  color: #333;
}

.modal-close {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  font-size: 18px;
  color: #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #666;
}

.qrcode-container {
  padding: 20px;
  background: #f5f5f5;
  border-radius: 4px;
  display: flex;
  justify-content: center;
}

/* 自定义复选框 */
.checkbox-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-input {
  order: 3;
  margin-left: auto;
  align-self: center;
  position: relative;
  width: 16px;
  height: 16px;
  border: 1px solid #ddd;
  border-radius: 2px;
  background: white;
  cursor: pointer;
}

.checkbox-input:checked {
  background: #1a73e8;
  border-color: #1a73e8;
}

.checkbox-input:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* 缩略图区域 */
.thumb-area {
  order: 1;
}

/* 内容区域 */
.content {
  order: 2;
  flex: 1;
}

/* 动画效果 */
@keyframes spin {
  to {
      transform: rotate(360deg);
  }
}

/* 工具提示 */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 12px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 1000;
}

[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.8);
}

.action-btn.copy-url,
.action-btn.send-to-phone {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.action-btn.send-to-phone::before {
  content: '📱';
  font-size: 14px;
}

.action-btn.copy-url:hover,
.action-btn.send-to-phone:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

/* 解析按钮样式 */
.retry-btn {
  width: 80px;
  height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
  flex-shrink: 0;
  white-space: nowrap;
}

.retry-btn::before {
  content: '↻';
  font-size: 14px;
  line-height: 1;
}

.retry-btn:hover {
  background: var(--hover-gradient);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
}

/* 播放按钮样式 */
.action-btn.open {
  background: var(--success-gradient);
  color: white;
  border: none;
  box-shadow: 0 2px 4px rgba(34, 197, 94, 0.2);
}

.action-btn.open:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(34, 197, 94, 0.3);
}

.action-btn.open::before {
  content: '▶';
  font-size: 12px;
  margin-right: 4px;
}

/* 统一标题/URL样式 */
.title, .url {
  font-size: 14px;
  line-height: 1.5;
  color: #1e293b;
  margin-bottom: 8px;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 解析中和解析失败状态的URL样式 */
.resource-item.parsing .url,
.resource-item.failed .url {
  font-size: 14px;
  line-height: 1.5;
  color: #1e293b;
  margin-bottom: 8px;
  word-break: break-word;
  text-decoration: underline;
}
.resource-item.failed .url:hover {
  color: #1a73e8;
  cursor: pointer;
}

.progress-area .file-path
{
  font-size: 14px;
  line-height: 1.5;
  color: #1e293b;
  margin-bottom: 8px;
  word-break: break-word;
  text-decoration: underline;
}
.progress-area .file-path:hover {
  color: #1a73e8;
  cursor: pointer;
}

/* 缩略图样式 */
.thumb {
  width: 160px;  /* 固定宽度 */
  height: 90px;  /* 16:9 比例 */
  object-fit: cover;  /* 保持比例裁剪 */
  border-radius: 8px;  /* 圆角 */
  background: #f1f5f9;  /* 图片加载前的背景色 */
  flex-shrink: 0;  /* 防止被压缩 */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);  /* 轻微阴影 */
  cursor: pointer;
  transition: transform 0.5s ease;
}
.thumb:hover{
  transform: scale(1.1);
}
/* 图片加载失败时的占位样式 */
.thumb:not([src]),
.thumb[src=""],
.thumb[src*="error"] {
  background: #f1f5f9 url('../assets/default-thumbnail.png') center/48px no-repeat;  /* 添加占位图标 */
}

/* 消息提示样式 */
.message-toast {
  position: absolute;
  top: 60px;  /* 调整位置，靠近输入框 */
  left: 550px;
  background: #fee2e2;
  padding: 8px 12px;
  border-radius: 4px;
  color: #dc2626;
  font-size: 14px;
  opacity: 1;
  transition: opacity 0.3s ease;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 添加箭头样式 */
.message-toast::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 20px;
  width: 12px;
  height: 12px;
  background: #fee2e2;
  transform: rotate(45deg);
  box-shadow: -2px -2px 2px rgba(0, 0, 0, 0.03);
}

.message-toast.hidden {
  opacity: 0;
  pointer-events: none;
}